﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>大厅等候</title>
    <link href="/static/web/hall/css.css" rel="stylesheet" />
    <script src="/static/web/hall/jquery.min.js"></script>
</head>
<body>
<div class="main">
    <div class="qmj">
        <div class="right">
            <div class="list" id="list">
                
            </div>
            <div class="call" id="call">
                
            </div>
    </div></div>
  </div>  
</body>
</html>
<script type="text/javascript">
    
   
    
    function GetList() {
        try {
            var html = "";
            $.ajax({
                type: "GET",
                async: false,
                url: "/call_patient/list_patient_wait?t=" + new Date().getTime(),
                contentType: "application/text;charset=utf-8",
                dataType: "json",
                cache: false,
                success: function (data) {
                    $("#list").html("");
                    //$("#triage_name").html(data.fztname);
                    $.each(data.list, function (i, item) {
                        if (i % 2 == 0)
                            html += "<div class='zs_list'><ul><li class='bg'>" + data.list[i].zsmc + "</li><li class='bg'>" + data.list[i].dh_name0 + "</li><li class='bg'>" + data.list[i].dh_name1 + "</li><li class='bg'>" + data.list[i].dh_name2 + "</li></ul></div>";
                        else
                            html += "<div class='zs_list'><ul><li>" + data.list[i].zsmc + "</li><li>" + data.list[i].dh_name0 + "</li><li>" + data.list[i].dh_name1 + "</li><li>" + data.list[i].dh_name2 + "</li></ul></div>";
                    });
                    $("#list").html(html);
                },
                error: function () {
                    //$("#triage_name").html("未知");
                }
            });
        }
        catch (err)
        { 
        	//$("#triage_name").html(err);
            }
    }

    function PagerCall() {
        //try {
            $.ajax({
                type: "GET",
                url: "/clientPatientQueue/list_patient_call?t=" + new Date().getTime(),
                contentType: "application/text;charset=utf-8",
                dataType: "json",
                cache: false,
                success: function (data) {
                    var k = 0;
                    for (var i = 0; i < data.list.length; i++) {
                        //$.each(data.list, function (j, item) {
                        //    //if (item.hjzt == 1) {
                        var item = data.list[i];

                        var t = ("请 " + item.patient_name + " 到" + item.jhqmc + "就诊。").length * 400;
                        setTimeout("showtips(" + t + ", '" + item.patient_name + "','" + item.jhqmc + "','" + item.register_id + "')", k);

                        k = k + t;

                    }
                    setTimeout(PagerCall, k);
                },
                error: function () {

                }
            });
        //}
        //catch (err)
        //{ }
    }
    function showtips(t, name, jhqmc, id) {
        //try {
            $("#call").html("请 " + id + "号" + name + " 到" + jhqmc + "就诊");
            var callText = "<?xml version=\"1.0\" encoding=\"GB18030\"?>"
                + "<Contents><Content>"
                + "<Voice Num=\"1\" Speed=\"1000\" digitMode=\"1\">"
                + "请 " + id + "号" + name + " 到" + jhqmc + "就诊。"
                + "</Voice>"
                + "</Content></Contents>";
                //alert(callText);
            window.Callobject.playVoice(callText);
        //}
        //catch (err)
        //{ }
    }
    GetList();
    PagerCall();
    //ShowTime();
    
    window.setInterval(GetList, 2000);
    //window.setInterval(ShowTime, 5000);
</script>